package com.zr.storehouse.controller;

import com.zr.storehouse.model.vo.WarehouseSelectVo;
import com.zr.storehouse.model.vo.WarehouseStatusVo;
import com.zr.storehouse.service.StoreHouseService;
import com.zr.util.AllRecords;
import com.zr.util.ResultVO;
import com.zr.util.ResultVOBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2019/1/11.

*/
@RestController
public class StoreHouseController {

    @Autowired
    private StoreHouseService storehouseservice;

    @CrossOrigin
    @PostMapping("iwm/getPullDownList")
    public ResultVO<List<WarehouseStatusVo>> getPullDownList() {
        List<WarehouseStatusVo> subClassStatusList = new ArrayList<>();

        WarehouseStatusVo subClassStatus = new WarehouseStatusVo();
        subClassStatus.setLabel("启用");
        subClassStatus.setValue(true);
        subClassStatusList.add(subClassStatus);

        WarehouseStatusVo subClassStatus1 = new WarehouseStatusVo();
        subClassStatus1.setLabel("禁用");
        subClassStatus1.setValue(false);
        subClassStatusList.add(subClassStatus1);

        return ResultVOBuilder.success(subClassStatusList);
    }

    @CrossOrigin
    @PostMapping("warehouse/queryPage")
    public ResultVO<AllRecords> wareHousequeryPage(@RequestBody WarehouseSelectVo warehouseSelectVo) {

        return storehouseservice.queryStoreHouse(warehouseSelectVo);
    }
}